package fr.umlv.proxir.httpmessages;

import fr.umlv.proxir.page.Page;
import fr.umlv.proxir.page.PageInRAM;



/**
 * this class construct the forbidden page to return if a page is filtered
 * 
 * @author gourier & motais
 *
 */
public class AnswerFactory {

	/**
	 * construct the page containing FORBIDDEN in case the request page is filtered
	 * @param msg the message inside the forbidden page
	 * @return the forbidden page
	 */
	public static Page buildForbiddenAnswer(String msg){
		String content = "<HTML><HEAD><TITLE>Forbidden</TITLE></HEAD>\n<BODY><H1>Forbidden</H1>\n"+msg+"\n</BODY></HTML>";
		Page p=new PageInRAM(new String("HTTP/1.1 403 Forbidden\nServer: ProxIR\nDate: Wed, 16 Jul 2008 07:57:24 GMT\nContent-length: "+content.length()+"\nContent-type: text/html\nConnection: close\r\n\r\n\n"+content).getBytes());
		return p;
	}

}
